﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace TextBasedRpg
{
    public class Program
    {
        public static bool IsRunning { get; set; }
        
        static void Main()
        {
            Command.setupMenu();
            IsRunning = true;

            Console.WriteLine("Welcome to the Text Based RPG by Cava Studios!");
            Console.WriteLine("Please enter a command.");

            while (IsRunning)
            {
                Console.WriteLine();
                Console.Write(">");

                var input = Console.ReadLine() ?? string.Empty;
                var inputStrings = input.ToLower().Split(' ');
                var command = inputStrings[0];
                var options = inputStrings.Skip(1).ToArray();

                try
                {
                    Command.Menu[command](options);
                }
                catch (KeyNotFoundException)
                {
                    Console.WriteLine("I beg your pardon?");
                }
            }
        }
    }
}
